<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no, initial-scale=1" />
		<meta content="yes" name="apple-mobile-web-app-capable" />
		<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
		<meta content="telephone=no" name="format-detection" />
		<title>贷款意向</title>
		<link rel="stylesheet" type="text/css" href="../../unifypreloan/css/base.css" />
		<!--自适应插件-->
		<script type="text/javascript" src="../../unifypreloan/js/FS.js"></script>
		<!--多彩icon-->
		<script type="text/javascript" src="../../unifypreloan/fonts/iconfont.js"></script>
	</head>

	<body class="">
		<div class="fixBottom bgf fh1">
			<div class="wx-btn" onclick="submitForm();">下一步</div>
		</div>
		<div class="wx-content">
				<form name='myForm' id="myForm" action="" method="post">
					<input id="custId" name="custId" type="hidden" th:value="${custId}" />
					<input id="loginSerId" name="loginSerId" type="hidden" th:value="${loginSerId}" />
					<input id="phoneNo" name="phoneNo" type="hidden" th:value="${phoneNo}" />
					<input id="acctNo" name="acctNo" type="hidden" th:value="${acctNo}" />
					<input id="mchtCd" name="mchtCd" type="hidden" th:value="${mchtCd}" />
					<input id="wishLimit" name="wishLimit" type="hidden" th:value="${wishLimit}" />
					<input id="wishTerm" name="wishTerm" type="hidden" th:value="${wishTerm}" />
					<ul class="wx-formlist wx-formlist-noicon" style="padding-bottom: 40px;">
					<li class="wkbox">
						<div class="tl">期望贷款额度</div>
						<div class="autoW tr wx-input-group">
							<input id="money" type="tel" value="" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" placeholder="" maxlength="2" />
						</div>
						<div class="pl10">万元</div>
					</li>
					</ul>
					<div style="background: #F7F7F7;height: 0.32rem;"></div>
					<ul class="wx-formlist  wx-formlist-noicon">
					<li class="wkbox">
						<div class="tl">贷款期限</div>
						<div class="autoW tr cl3c wx-input-group wx-navigate-right">
							<span id="fxdkqx" class="wx-form-text">请选择</span>
							<select id="dkqx" class="wx-select">
								<option value="">请选择</option>
								<option value="3月">3月</option>
								<option value="6月">6月</option>
								<option value="9月">9月</option>
								<option value="12月">12月</option>
							</select>
						</div>
					</li>
					<li class="wkbox twoLine">
						<div class="tl">
						<div>本人常用银行卡号</div>
						<div class="f14 cl9 mt6">推荐输入信用卡号</div>
						</div>
						<div class="autoW tr wx-input-group">
							<input id="brcyyhk" type="tel" value="" placeholder="" maxlength="30" />
						</div>
					</li>
					<li class="wkbox">
						<div class="tl">
						常用POS机编号
						</div>
						<div class="pl4" onclick="guide();">
							<span class="iconfont icon-tishi1 cllan f20"></span>
						</div>
						<div class="autoW tr wx-input-group">
							<input id="cyposid" type="text" value="" placeholder="" maxlength="30" />
						</div>
					</li>
					</ul>
				</form>
		</div>
		<div class="wx-tips-noAlert" style="display: none;">
			<div style="width: 80px; height: 80px; position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%);">
				<img style="width: 100%; opacity: .8;" src="images/loading.gif" />
			</div>
		</div>
		<script src="../../unifypreloan/vendor/jquery-2.1.3.min.js"></script>
		<script type="text/javascript" src="../../unifypreloan/js/wx.js"></script>
		<script src="../../unifypreloan/js/validate.js"></script>
		<script>
			//初始化表单校验规则 v1.0 by wangxiang3
			validate.init({
				rules: {
					money:"required",
					dkqx: "required",
					brcyyhk: "required",
					cyposid:"required"
				},
				messages: {
				}
			})

			$(function() {
				if ($('#acctNo').val().trim() != '') {
					$('#brcyyhk').val($('#acctNo').val());
				}
				
				if ($('#mchtCd').val().trim() != '') {
					$('#cyposid').val($('#mchtCd').val());
				}
				
				if ($('#wishLimit').val().trim() != '') {
					$('#money').val($('#wishLimit').val());
				}
				
				if ($('#wishTerm').val().trim() != '') {
					$('#fxdkqx').text($('#wishTerm').val());
					$('#dkqx').val($('#wishTerm').val());
				}
			});
			
			function submitForm() {
				if (validate.submitForm()) {
					$('.wx-tips-noAlert').show();
					$.ajax({
						type: "POST",
						dataType: "JSON",
						url: "userIntent",
						data: {
							custId: $('#custId').val().trim(),
							loginSerId: $('#loginSerId').val().trim(),
							phoneNo: $('#phoneNo').val().trim(),
							money: $("#money").val().trim(),
							dkqx: $("#dkqx").val().trim(),
							brcyyhk: $("#brcyyhk").val().trim(),
							cyposid: $("#cyposid").val().trim()
						},
						error: function(XMLHttpRequest, textStatus, errorThrown) {
							alert("系统繁忙，请稍后再试")
						},
						success: function(res) {
							if(res.code=="000000"){
								$('#myForm').attr("action", "riskAppend").submit();
							}else if(res.code=="000001"){
								alert("请填写本人的银行卡或信用卡");
							}else if(res.code=="000002"){
								alert("您已经提交过申请,不能重复提交,请重登后再试！");
							}else{
								window.location = 'applyFail.html';
							}
						}
					});
					$('.wx-tips-noAlert').hide();
				}
			}
			
			function guide() {
				$('#myForm').attr("action", "toGuide").submit();
			}
		</script>
	</body>

</html>